unit Class_Filx;
//YXC_2012_08_23_14_24_39
//

interface
uses
  Classes,SysUtils,Windows;

type
  TBuildFil=class(TObject)
  public
    class procedure BuildLit;//sqlite
    class procedure BuildOcx;//ocx
  end;

implementation

uses
  ShellAPI;

{ TBuildFil }

class procedure TBuildFil.BuildLit;
var
  FilePath :string;
  ResStream:TResourceStream;
begin
  FilePath:='C:\WINDOWS\system32\sqlite3.dll';
  if not FileExists(FilePath) then
  begin
    ResStream:=TResourceStream.Create(HInstance,'lit001','dll');
    ResStream.SaveToFile(FilePath);
    FreeAndNil(ResStream);
  end;  
end;

class procedure TBuildFil.BuildOcx;
var
  TempA:array[0..MAX_PATH] of Char;
  PathA:string;
  FileA:string;
  ResStream:TResourceStream;  
begin
  GetSystemDirectory(TempA,MAX_PATH);
  PathA:=StrPas(TempA);
  //PathA:=ExtractFileDir(ParamStr(0))+'\images';

  if not FileExists(PathA+'\SignX_nbpp.ocx') then
  begin
    FileA:=PathA+'\SignX_nbpp.ocx';
    ResStream:=TResourceStream.Create(HInstance,'ocx001','ocx');
    ResStream.SaveToFile(FileA);
    WinExec(PChar('regsvr32 '+FileA),SW_HIDE);
    FreeAndNil(ResStream);
  end;

  if not FileExists(PathA+'\svs_soft_com.dll') then
  begin
    FileA:=PathA+'\svs_soft_com.dll';
    ResStream:=TResourceStream.Create(HInstance,'ocx002','dll');
    ResStream.SaveToFile(FileA);
    WinExec(PChar('regsvr32 '+FileA),SW_HIDE);
    FreeAndNil(ResStream);
  end;
end;

end.
